/*
*
* Copyright: Gzccc
*/
(function($){
	//显示二维码信息
	QRshow();
	//加载更多信息
	$('.load-more').on('click',function(){
		loadMore();
	});
	//Loading Content!
	loadMask();
	closeMask();
})(jQuery);

function QRshow(){
	$("#thanks").mouseover(function(){
		$("#qr").attr('src','img/2d.png');
		$("#qr").css("display","block");
	});
	$("#connect").mouseover(function(){
		$("#qr").attr('src','img/connect.png');
		$("#qr").css("display","block");
	});
	$("#thanks,#connect").mouseout(function(){
		$("#qr").hide();
	});
};

function loadMore(){
	var dataInt = {"data":[{"src":"1.jpg"},{"src":"2.jpg"},{"src":"3.jpg"},{"src":"4.jpg"},{"src":"5.jpg"},{"src":"6.jpg"},{"src":"p3.jpg"},{"src":"p2.jpg"},{"src":"p1.jpg"}]}
	
		if(checkScrollSlide()){
			$.each(dataInt.data,function(key,value){
				/*图片流*/
				var oBox = $('<div>').addClass('box').appendTo($('#main'));
				var oPic = $('<div>').addClass('pic').appendTo($(oBox));
				$('<img>').attr('src','img/'+$(value).attr('src')).appendTo($(oPic));
				/*简介瀑布流*/
				var oIntroduce = $('<div>').addClass('introduce').appendTo($(oBox)).append('这是一个简介');
			})
		}
	
}

function checkScrollSlide(){ /*判断是否满足加载*/
	var $lastBox = $('#main>div').last();
	var lastBoxDis = $lastBox.offset().top+$lastBox.outerHeight();
	var scrollTop = $(window).scrollTop();
	var documentH = $(window).height();
	return (lastBoxDis<scrollTop+documentH)?true:false;
}

/**
*   Loading Content
*/
function loadMask(){
	$('.introduce,.introduce>h2,introduce>p').on('click',function(){
		$('.mask').show();
	});
}
function closeMask(){
	$('.close').on('click',function(){
		$('.mask').hide();
	});
}